package com.java.add;

import com.java.ueils.DruidUtils;

import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


public class Test1 {
    public static void main(String[] args) throws Exception {
        Connection connection = DruidUtils.getConnection();
        String  sql = "select * from employee where name =? and gender = ?";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setString(1,"楪祁");
        ps.setString(2,"女");
        ResultSet resultSet = ps.executeQuery();
        while (resultSet.next()){
            int id = resultSet.getInt("id");
            String name = resultSet.getString("NAME");
            String gender = resultSet.getString("gender");
            double salary = resultSet.getDouble("salary");
            double bonus = resultSet.getDouble("bonus");
            Date join_date = resultSet.getDate("join_date");
            System.out.println(id + " " + name + " " + gender + " " + salary + " " + bonus + " " + join_date);
        }
        DruidUtils.close(connection,ps,resultSet);
    }
}
